package com.utils;

import java.io.FileReader;
import java.io.Reader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
import java.util.UUID;

public class JDBCUtils {
    public static String drivername;
    public static String url;
    public static String username;
    public static String password;

    static {
        try {
        	Properties p=new Properties();
        	Reader reader=new FileReader("jdbc.properties");
        	p.load(reader);
        	drivername =p.getProperty("drivername");
        	url =p.getProperty("url");
        	username =p.getProperty("username");
        	password =p.getProperty("password");
            Class.forName(drivername);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static Connection getCon() throws SQLException {
        Connection connection = null;
        connection = DriverManager.getConnection(url, username, password);
        return connection;
    }
}
